package Object_oriented_comprehensive_case_study;

public class MovieOperator {
    private Movie[] movies;

    public MovieOperator(Movie[] movies) {
        this.movies = movies;
    }

    //展示电影信息
    public void printAllMovies() {
        System.out.println("-------全部电影基本信息如下------");
        for (int i = 0; i < movies.length; i++) {
            System.out.println("编号:" + movies[i].getId());
            System.out.println("名称:" + movies[i].getName());
            System.out.println("价格:" + movies[i].getPrice());
            System.out.println("----------------------");
        }

    }

    //根据电影编号查询电影信息
    public void searchMovieById(int id) {
        System.out.println("该电影详情如下");
        for (int i = 0; i < movies.length; i++) {
            if (movies[i].getId() == id) {
                System.out.println("编号:" + movies[i].getId());
                System.out.println("名称:" + movies[i].getName());
                System.out.println("价格:" + movies[i].getPrice());
                System.out.println("得分:" + movies[i].getScore());
                System.out.println("导演:" + movies[i].getDirector());
                System.out.println("主演:" + movies[i].getActor());
                System.out.println("其他信息:" + movies[i].getInfo());
                return;
            }
        }
        System.out.println("没有该编号的电影详情");
    }

}
